<div class="container">
<form action="module.php?m=product&s=product_unify.php" method="post" name="unify" id="unify">
<{if $smarty.get.type=='stock'}>
<table class="table3">
	<tbody>
        <tr>
            <td colspan="99">
                <ul class="tips">
                    <li>不可输入小数点、负数和非数字内容。</li>
                    <li>"将原库存修改为"是指将所选商品的库存统一修改某个值。</li>
                    <li>"公式调库存"是指在每个商品原有库存的基础上同幅度增加或者同幅度减少。</li>
                </ul>
            </td>
        </tr>
	</tbody>
 
    <tbody>
	<tr>
    	<td width="80">
        	<input type="radio" name="type" value="1" id="s1" checked><label for="s1">直接修改</label>
        </td>
        <td width="30">库存</td>
        <td width="10">=</td>
        <td colspan="2"><input type="text" name="stock1" value="" /></td>
    </tr>
	<tr>
    	<td><input type="radio" name="type" value="2" id="s2"><label for="s2">公式修改</label></td>
        <td>库存</td>
        <td>=</td>
        <td width="90">
        当前库存
        <select name="fun">
        	<option value="+">+</option>
        	<option value="-">-</option>
        	<option value="*">*</option>
        </select>
        </td>
        <td><input type="text" name="stock2" value="" /></td>
    </tr>
    </tbody>
	<tr>
    	<td colspan="99"><input type="button" id="unify_buttom" class="submit" value="保存"></td>
    </tr>
</table>
<input type="hidden" name="act" value="stock">
<{elseif $smarty.get.type=='price'}>
<table class="table3">
	<tbody>
        <tr>
            <td colspan="99">
                <ul class="tips">
                    <li>小技巧：直接修改：对所选商品的某个价格进行统一修改。</li>
                    <li>公式调价：将所选商品的某个价格修改为在另一个价格的基础上加减乘一个数字。</li>
                </ul>
            </td>
        </tr>
	</tbody>
 
    <tbody>
	<tr>
    	<td width="80">
        	<input type="radio" name="type" value="1" id="s1" checked><label for="s1">直接修改</label>
        </td>
        <td width="70">
        <select name="name">
        	<option value="price">销售价</option>
        	<option value="market_price">市场价</option>
        	<option value="cost_price">成本价</option>
        </select>
        </td>
        <td width="10">=</td>
        <td colspan="2"><input type="text" name="price1" value="" /></td>
    </tr>
	<tr>
    	<td><input type="radio" name="type" value="2" id="s2"><label for="s2">公式修改</label></td>
        <td>
        <select name="name1">
        	<option value="price">销售价</option>
        	<option value="market_price">市场价</option>
        	<option value="cost_price">成本价</option>
        </select>
        </td>
        <td>=</td>
        <td width="120">
        <select name="name2">
        	<option value="price">销售价</option>
        	<option value="market_price">市场价</option>
        	<option value="cost_price">成本价</option>
        </select>
        <select name="fun">
        	<option value="+">+</option>
        	<option value="-">-</option>
        	<option value="*">*</option>
        </select>
        </td>
        <td><input type="text" name="price2" value="" /></td>
    </tr>
    </tbody>
	<tr>
    	<td colspan="99"><input type="button" id="unify_buttom" class="submit" value="保存"></td>
    </tr>
</table>
<input type="hidden" name="act" value="price">
<{/if}>
<input type="hidden" name="id" value="<{$smarty.get.id}>">
</form>
<script>
function $$(id) {
	return !id ? null : document.getElementById(id);
}
function ajaxpost(formid) {
	
	var ajaxframeid = 'ajaxframe';
	var ajaxframe = $$(ajaxframeid);
	if(!ajaxframe){
		var div = document.createElement('div');
		div.style.display = 'none';
		div.innerHTML = '<iframe name="' + ajaxframeid + '" id="' + ajaxframeid + '" loading="1"></iframe>';
		ajaxframe = $$(ajaxframeid);
		$$('append_parent').appendChild(div);
	}
	$$(formid).target = ajaxframeid;
	$$(formid).submit();
	window.parent.main.document.location.reload();
	DialogManager.close("unify");
	
}
$("#unify_buttom").click(function () {
	ajaxpost("unify");
	return false;
});
</script>
</div>